﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class manframe : System.Web.UI.Page
{
    public string browser;
    public string browserVersion;
    public bool isCookies;
    public bool isJS;

    protected void Page_Load(object sender, EventArgs e)
    {
        browser = this.Request.Browser.Type;
        browserVersion = this.Request.Browser.Version;
        isCookies = this.Request.Browser.Cookies;
        isJS = this.Request.Browser.JavaScript;

        //检查浏览器版本
        if (browser.Contains("IE"))
        {
            Label1.Text = "(正常)";
            Label1.ForeColor = System.Drawing.Color.Green;

            if (decimal.Parse(browserVersion) <= 6)
            {
                Label2.Text = "(建议使用IE6.0以上版本)";
                Label2.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                Label2.Text = "（正常）";
                Label2.ForeColor = System.Drawing.Color.Green;
            }
        }
        else
        {
            Label1.Text = "(建议使用IE浏览器)";
            Label1.ForeColor = System.Drawing.Color.Red;
        }
        //检查浏览器是否启用cookie
        if (isCookies)
        {
            Label3.Text = "（正常）";
            Label3.ForeColor = System.Drawing.Color.Green;
        }
        else
        {
            Label3.Text = "（浏览器设置异常）";
            Label3.ForeColor = System.Drawing.Color.Red;
        }
        //检查浏览器是否支持js
        if (isCookies)
        {
            Label4.Text = "（正常）";
            Label4.ForeColor = System.Drawing.Color.Green;
        }
        else
        {
            Label4.Text = "（浏览器设置异常）";
            Label4.ForeColor = System.Drawing.Color.Red;
        }
    }
}